<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- push向后添加 -->
    <script>
        var arr1=[1,2,3,4];
        var arr2 = ["a","b"];
        arr1.push(5,6);
        // 普通方式
        for( let i=0;i<arr2.length;i++){
            arr1.push(arr2[i])
        }; 
        // 展开语法
        arr1.push(...arr2)  
        console.log(arr1);
        console.log(...arr1);//将一个数组展开
    </script>

    <!-- unshift向前添加 -->
    <script>
        var a = [1,2,3];
        var b = [4,5,6];
        b.unshift(...a);
        console.log(...b)
    </script>

    <!-- concat数组拼接 -->
    <script>
        var c = [1,2,3];
        var d = ["a","b"];
        var e = c.concat(d);
        console.log(...e)
    </script>
</body>
</html>